package paritclecontainer2d;

import java.awt.Color;
import java.awt.Graphics;
import java.util.Random;

public class RandomParticle extends ColoredParticle {

	private static final int DEFAULT_DIMENSION = 25;
	
	
	public RandomParticle(){
		super(null, TTL_CAP, DEFAULT_DIMENSION, DEFAULT_DIMENSION);
	}
	
	
	public RandomParticle(double timeToLife, int width, int height, boolean fill) {
		super(null, timeToLife, width, height, fill);
	}

	public RandomParticle(double timeToLife, int width, int height) {
		super(null, timeToLife, width, height);
	}

	@Override
	public void paintComponent(Graphics arg) {
		System.out.println(ttl);
		
		Random random = new Random();
		
		float r = random.nextFloat();
		float g = random.nextFloat()*0.95f;
		float b = random.nextFloat()*0.95f;
		
		this.color = new Color(r, g, b);
		super.paintComponent(arg);
		
		
	}

	@Override
	public Object clone() throws CloneNotSupportedException {
		return new RandomParticle(ttl, width, height, fill);
	}

}
